﻿using System.Diagnostics.Contracts;

namespace BlindData
{
	public static class PositiveGenerator
	{
		/// <summary>
		/// Returns a positive random int.
		/// </summary>
		/// <returns></returns>
		public static int Positive(this INext<int> next)
		{
			Contract.Requires(next != null);

			return next.Between(1, int.MaxValue);
		}

		/// <summary>
		/// Returns a positive random long.
		/// </summary>
		/// <returns></returns>
		public static long Positive(this INext<long> next)
		{
			Contract.Requires(next != null);

			return next.Between(1, long.MaxValue);
		}

		/// <summary>
		/// Returns a positive random double.
		/// </summary>
		/// <returns></returns>
		public static double Positive(this INext<double> next)
		{
			Contract.Requires(next != null);

			return next.Between(double.Epsilon, double.MaxValue);
		}

		/// <summary>
		/// Returns a positive random float.
		/// </summary>
		/// <returns></returns>
		public static float Positive(this INext<float> next)
		{
			Contract.Requires(next != null);

			return next.Between(float.Epsilon, float.MaxValue);
		}

		/// <summary>
		/// Returns a positive random decimal.
		/// </summary>
		/// <returns></returns>
		public static decimal Positive(this INext<decimal> next)
		{
			Contract.Requires(next != null);

			return next.Between((decimal)double.Epsilon, decimal.MaxValue);
		}
	}
}
